#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDate>
#include <QTime>
#include <QDebug>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent), ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    ui->lcdNumber->display("2025-01-01 00:00:00");

    timer = new QTimer();
    timer->setInterval(1000);
    connect(timer, SIGNAL(timeout()), this, SLOT(func()));

    timer->start();
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::func()
{
    auto currentDate = QDate::currentDate();
    QString date = currentDate.toString("yyyy-MM-dd");

    auto currentTime = QTime::currentTime();
    QString time = currentTime.toString("hh:mm:ss");

    ui->lcdNumber->display(date + " " + time);
}
